package diamondRingService.impl;

import diamondRingDao.impl.AddressDaoImpl;
import diamondRingEntity.Address;
import diamondRingService.AddressService;
import tool.BaseDao;

import java.util.List;

public class AddressServiceImpl extends BaseDao implements AddressService {
    AddressDaoImpl addressDao=new AddressDaoImpl();
    @Override
    public List<Address> addFind(int userid) {
        List<Address> addressList=null;
        if (userid>0){
            addressList=addressDao.addFind(userid);
        }
        return addressList;
    }

    @Override
    public int addInsert(Address address) {
        int count=0;
        if (address!=null){
            count=addressDao.addInsert(address);
        }else {
            count=-1;
        }
        return count;
    }

    @Override
    public int addUpdate(Address address) {
        int count=0;
        if (address!=null){
            count=addressDao.addUpdate(address);
        }else {
            count=-1;
        }
        return count;
    }

    @Override
    public int addDelete(int userid, int addressid) {
        int count=0;
        if (userid>0&&addressid>0){
            count=addressDao.addDelete(userid,addressid);
        }else {
            count=-1;
        }
        return count;
    }
}
